<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Jenssegers\Mongodb\Eloquent\Model;

class LocalOrderList extends Model
{
    use HasFactory;
    //
    protected $connection = 'mongodb';
    protected $collection = 'localorderlist';

    public static function make($data)
    {
        $obj = self::create($data);
        if (empty($obj))
            return null;
        return $obj;
    }

    public static function updateStatus($orderId, $status)
    {
        self::where("order_id", $orderId)->update([
            "status" => $status
        ]);
    }
}
